<template>
  <div class="recordList-container">
    <div class="integral-content">
      <div class="integral-item">积分余额：{{ tokens }}</div>
      <div class="integral-item">
        VIP过期时间：{{ expireTime | amountFormat }}
      </div>
    </div>
    <div class="recharge-content">
      <div class="title">充值记录</div>
      <div class="table">
        <el-row class="table-item" :gutter="20">
          <el-col :span="2">日期</el-col>
          <el-col :span="4">交易方式</el-col>
          <el-col :span="4">金额</el-col>
          <el-col :span="5">用途</el-col>
        </el-row>
        <el-row
          v-for="item in payList"
          :key="item.id"
          class="table-item"
          :gutter="20"
        >
          <el-col :span="2">{{ item.createTime | dateFormat }}</el-col>
          <el-col :span="4">微信</el-col>
          <el-col :span="4">￥{{ item.totalFee | amountFormat }}</el-col>
          <el-col :span="5">{{ item.title }}</el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
import { fetchData } from "@/utils";
import { getPayList } from "@/api/api";
export default {
  name: "RecordList",
  props: {
    tokens: {
      type: String,
      default: "",
    },
    expireTime: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      userid: 1,
      payList: [],
    };
  },
  created() {
    this.getPayList();
  },
  methods: {
    getPayList() {
      fetchData(getPayList, this.userid).then((res) => {
        this.payList = res; //res.filter(item => item.orderstatus == '支付成功');
      });
    },
  },
};
</script>

<style lang="less" scoped>
.recordList-container {
  padding: 30px 0;
  .integral-content {
    display: flex;
    align-items: center;
    color: var(--color-user-text);
    .integral-item {
      width: 230px;
      height: 20px;
      padding-right: 10px;
      box-sizing: border-box;
      display: flex;
      align-items: center;
      font-size: 14px;
      font-weight: 400;
    }
  }
  .recharge-content {
    .title {
      font-size: 18px;
      font-weight: 700;
      line-height: 26px;
      margin: 30px 0 15px 0;
      color: var(--color-nav-text);
    }
  }
  .table {
    width: 100%;
    font-size: 13px;
    font-weight: 400;
    color: var(--color-user-text);
    text-align: center;
    .table-item {
      margin-bottom: 20px;
    }
  }
}
</style>
